<?php
if (!isset($_SESSION["menu"]))
    $idMenuOld = 1;
else
    $idMenuOld = $_SESSION["menu"];

$idMenu = $_REQUEST['idMenu'];
$idWeek = 1;

if ($idMenu < 10) {
    $idWeek = $idMenu;
    $idMenu = $idMenuOld;
}
if ($idMenu > 10) {

    $idMenu = intval($idMenu / 10);
    $_SESSION["menu"] = $idMenu;
}

$getData = new GetData();
$ListLesson = $getData->GetListLesson();
?>



<h4><b><?php
if ($idMenu == 1)
    echo"Beginner A1";
if ($idMenu == 2)
    echo"Beginner A2";
if ($idMenu == 3)
    echo"Imtermeditate B1";
if ($idMenu == 4)
    echo"Imtermeditate B2";
?>

    </b></h4>
<br/>
<div id="WeekTabs">
    <ul>
        <li><a href="#" onclick='ClickCourse(1);'><b>Week 1</b></a></li>
        <li><a href="#" onclick='ClickCourse(2);'><b>Week 2</b></a></li>
        <li><a href="#" onclick='ClickCourse(3);'><b>Week 3</b></a></li>
        <li><a href="#" onclick='ClickCourse(4);'><b>Week 4</b></a></li>
    </ul>
    <br/>
    <hr>
</div><!-- end WeekTabs --> 






<div id="ListLesson">

    <ul>
        <?php
        $List4lesson = array();
        $IDWeekResult = ($idMenu - 1) * 4 + $idWeek;
        $IDUserOnline = elgg_get_logged_in_user_guid();
       
        
        while ($row = mysql_fetch_array($ListLesson)) {
            if (($row['ID_Week'] == $IDWeekResult)) {
                array_push($List4lesson, $row['Image']);
                array_push($List4lesson, $row['Name']);
                $valueStatus = 0;
                $resultStatus = $getData->GetListStatusByIDUser($IDUserOnline);
                 while ($row2 = mysql_fetch_array($resultStatus)){
                     if($row2['ID_lesson']==$row['ID'])
                         $valueStatus = $row2['Value'];
                         
                 }
                 array_push ($List4lesson,$valueStatus);
                 array_push($List4lesson, $row['ID']);
            }
        }
        ?>



        <?php for ($i = 0; $i < 4; $i++) { ?>	
            <li>
                <ul>
                    <li><a href="<?php echo elgg_add_action_tokens_to_url($vars['url'] .
                            'action/MyCourse/myLesson').'&id='.$List4lesson[$i * 4+3]; ?>"><img src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/<?php echo $List4lesson[$i * 4]; ?>" /></a></li>
                    <li ><a href="<?php echo elgg_add_action_tokens_to_url($vars['url'] .
                            'action/MyCourse/myLesson').'&id='.$List4lesson[$i * 4+3]; ?>"><b><?php echo $List4lesson[$i * 4 + 1]; ?></b></a></li>
                    <li><img src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/Resources/Tool/status/<?php echo $List4lesson[$i * 4 + 2];?>.jpg" /></li>
                    
                </ul>
            </li>
            <br/>
        <?php } ?>
    </ul>

</div>